var express = require('express')
var path = require('path')
var cookieParser = require('cookie-parser')
var logger = require('morgan')
const cors = require('cors')

var usersRouter = require('./routes/user.js')
var allRouter = require('./routes/all.js')
var trafficRouter = require('./routes/traffic.js')

var app = express()
app.use(cors())

app.use(logger('dev'))
app.use(express.json())
app.use(express.urlencoded({ extended: false }))
app.use(cookieParser())
app.use(express.static(path.join(__dirname, 'public')))

app.use('/API/V1/user', usersRouter)
app.use('/API/V1/all', allRouter)
app.use('/API/V1/traffic', trafficRouter)

module.exports = app
